package com.javazyw.entity.bo;
import java.lang.reflect.Method;
/**
 * <p>返回码枚举类型定义.</p>
 *
 * @version 
 * @author dongdh
 * @date 2015年5月19日
 *
 */
public enum ResponseEnum implements EnumMessage {

    RESPONSE_NUKONWN("0", "未知错误!"),
	RESPONSE_SUCCESS("1", "请求成功!"),
	RESPONSE_USER_EXIST("2", "验证用户已存在!"),
    RESPONSE_FREINDS_EXIST("3", "该好友已存在!"),
	RESPONSE_USER_NOEXIST("4", "验证用户不存在!"),
	RESPONSE_FREINDS_NOEXIST("5", "该好友不存在!"),
	RESPONSE_FREINDS_APPLY("6", "您已经向该用户添加好友申请,请耐心等待好友确认!"),
	RESPONSE_FREINDS_WAIT("7", "该好友已经向您添加好友申请，请您及时确认!"),
	RESPONSE_FREINDS_DELETE("8", "该好友删除，并将您从他的好友中移除!"),
	RESPONSE_MICROMSG_BINDING("9", "绑定手机号码成功!"),
	RESPONSE_FREINDS_CONFIRM("10", "好友确认成功!"),
	RESPONSE_FREINDS_CONFIRM_FAIL("11", "好友确认失败!"),
	RESPONSE_FREINDS_SENDMSG("12", "给好友发送消息成功!"),
	RESPONSE_FREINDS_SENDMSG_FAIL("13", "给好友发送消息失败!"),
    RESPONSE_DATA_IS_NULL("16", "上传的数据为空!"),
	
	RESPONSE_FORMAT_ERROR("-1", "请求格式不对!"),
	RESPONSE_AUTH_FAIL("-2", "校验失败!"),
	RESPONSE_SERVER_ERROR("-3", "服务器错误!"),
	RESPONSE_PASSWORD_ERROR("-4", "用户密码错误!"),
	RESPONSE_MOBILE_REG_ERROR("-5", "此手机号码已经注册过!"),
	RESPONSE_PARAM_EMPTY("14", "有为空的参数!"),
	RESPONSE_NUKONWN_METHOD("15", "无效的methodName!"),
    RESPONSE_PARAMS_ERROR("17", "参数异常!"),
    RESPONSE_VISITOR_NO_POWER("18", "游客不能修改数据!"),;

	public static ResponseEnum get(String status) {
		
		ResponseEnum[] list = values();
        for (ResponseEnum result : list) {
            if (status.equals(result.getStatus().toString())) {
                return result;
            }
        }
        return null;
    }
	
	public static void main(String[] args) {
		 t();
		 try {
			 System.out.println(ResponseEnum.valueOf("RESPONSE_AUTH_FAIL").getStatus());;
		} catch (Exception e) {
			e.printStackTrace();
		} 
	}
	
	public static void t () {
		
		/*ResponseEnum.valueOf("RESPONSE_AUTH_FAIL").setMsg("111");
		ResponseEnum.valueOf("RESPONSE_AUTH_FAIL").setStatus("11111");

        System.out.print(RESPONSE_AUTH_FAIL.getStatus());

        System.out.print(RESPONSE_AUTH_FAIL.getMsg());
		
		ResponseEnum.valueOf("RESPONSE_NUKONWN_METHOD").setMsg("222");
		ResponseEnum.valueOf("RESPONSE_NUKONWN_METHOD").setStatus("22222");*/
		
		try {
			/*Method method = ResponseEnum.class.getMethod("values");
			
			EnumMessage o[] = (EnumMessage[]) method.invoke(null, null);
			 
			 for (int i = 0; i < o.length; i++) {
				 EnumMessage m = o[i];
				 System.out.println(m);
			 }*/
			
			Method method = ResponseEnum.class.getMethod("valueOf", String.class);
			EnumMessage o = (EnumMessage) method.invoke(null, "RESPONSE_SUCCESS");
			o.setStatus("status");
			o.setMsg("msg");
		//	o.setMessage("aaaaaaaaaaaaaa");
			System.out.println(ResponseEnum.RESPONSE_SUCCESS.msg);
			
		} catch (Exception e) {
			e.printStackTrace();
		} 
		
	}
	
	
	private String status;
	
	private String msg;
	
    ResponseEnum(String status, String msg) {
		this.status = status;
		this.msg = msg;
	}

	public String getStatus() {
		return status;
	}

	public String getMsg() {
		return msg;
	}

	@Override
	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public void setMsg(String msg) {
		this.msg = msg;
	}


}
